import codecs
str = '''
    X{number}:{left}
    required:true,
    number:true
    {right},
'''

with codecs.open('test.txt', 'w', 'utf-8') as f:
    for i in range(1, 31):
        f.write(str.format(number=i, left='{', right='}'))
